﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace LFWeb3
{
    public class CustomAuthorizeAttribute : AuthorizeAttribute
    {

        public override void OnAuthorization(AuthorizationContext filterContext)
        {
            if (filterContext == null)
            {
                throw new ArgumentNullException("CustomAuthorize 验证 filterContext 对象为空");
            }

            if (filterContext.HttpContext.Session["UserName"] == null)
            {
                filterContext.Result = new RedirectResult("/AdminLogin/Index");
            }
        }
    }
}